Here you can write assessments. Please fill out all applicable boxes.

<?
$assid=(isset($_GET['assessment_id']) ? $_GET['assessment_id'] : 0);
$typeid=1;
if($assid!=0) {
	if(!canAccessAssessment($me->id,$assid)) {
		echo "You do not have access to this assessment.";
		die;
	}
$assinfo=getAssessment($assid);
$typeid=$assinfo['assessment_type_id'];

	echo "
	<input type=\"hidden\" name=\"action\" value=\"editassessment\">
	";
	
} else {
	if($me->isInGroup("Students")) {
		$personid=$me->id;
	} else {
		$personid=$_GET['personid'];
	}
	echo "
	<input type=\"hidden\" name=\"action\" value=\"writenewassessment\">
	<input type=\"hidden\" name=\"personid\" value=\"" . $personid . "\">
	";
	$assinfo=array();
	$assinfo['habits']=array();
	$typeid=(isset($_GET['assessment_type']) ? $_GET['assessment_type'] : 1);
}
$ass=getAssessmentTypeInfo($typeid);
$levels=getLevels();
$habitdata=array( array() );
$thabitdata=toHabitData($assinfo['habits']);
foreach($thabitdata as $key=>$temp) {
	foreach($temp as $key2=>$val) {
// 		echo "<br>REVERSE: $key-$key2=".($val*2);
		$habitdata[$key][$key2][($val*2)]="CHECKED";
	}
}

echo "
		<input type=\"hidden\" name=\"typeid\" value=\"" . $typeid . "\">
		<input type=\"hidden\" name=\"assid\" value=\"" . $assid . "\">
<br><br>
Description of your learning experience...
<br>
_____________________________________________________
<br>
<br>
Name of Learning Experience:
<br>
<input type=\"text\" name=\"assessment_name\" value=\"" . $assinfo['assessment_name'] . "\">
		<br><br>
";
foreach($ass['forms'] as $form) {
	echo $form['assessment_field_title'] . "<br>";
	echo showForm($form,$assinfo['values'][$form['assessment_field_id']]['assessment_field_value']) . "<br><br>";
}
echo "
</div>
Habit assessment (the ever awaited)...
<br>
_____________________________________________________
<br>
<br>
<select name=\"habits\" id=\"habitsselect\">
<option>Select A Habit</option>
";
$habits=getHabits();
foreach($habits as $habit=>$ind_a) {
	echo "<option value=\"" . $habit . "\">" . $habit . "</option>\n";
}

echo "
</select>
";
$i=0;
foreach($habits as $habit=>$ind_a) {
	echo "
<div id=\"habit" . $i . "\" style=\"position:absolute;width:690px;\">
<table border=\"1\">
<tr>
<td>N/A</td>
";
	foreach($levels as $lev) {
	echo "
<th colspan=\"1\">" . stripslashes($lev['level_name']) . "</th>";
	}
echo "</tr>";
$indnum=0;
	foreach($ind_a as $ind=>$descs) {
		
		echo "
		<tr>
		<td></td>
		<td colspan=\"" . (count($levels)*1) . "\">" . stripslashes($ind) . "
		</td></tr>
		<tr>
		<td>
				<input type=\"radio\" " . $habitdata[$i][$indnum][-2] . " name=\"habit" . $i . "ind" . $indnum . "\" value=\"-1\">
		</td>
		";
		foreach($levels as $lev) {
			echo "<td>
			<table border=\"0\" width=\"100%\">
			<tr><td align=\"right\">
					<input type=\"radio\" " . $habitdata[$i][$indnum][($lev['level_id']*2)] . " name=\"habit" . $i . "ind" . $indnum . "\" value=\"" . ($lev['level_id']) . "\">
			</td><td align=\"right\">
					<input type=\"radio\" " . $habitdata[$i][$indnum][(($lev['level_id']+.5)*2)] . " name=\"habit" . $i . "ind" . $indnum . "\" value=\"" . ($lev['level_id']+.5) . "\">
			</td></tr></table>
			</td>";
		}
		echo "
		</tr>
		<tr><td></td>";
		foreach($levels as $lev) {
			echo "
			<td colspan=\"1\">" . stripslashes($descs[$lev['level_name']]['habit_description_description']) . "</td>\n";
		}
		echo "</tr>";
		$indnum++;
	}
	echo "</table></div>";
	$i++;
}

echo "
<script>
<!--
var normalHeight;
window.onload = function() {
	var thing = document.getElementById(\"habitsselect\");
	";
	for($i=0;$i<count($habits);$i++) {
		echo "
	document.getElementById(\"habit" . $i . "\").style.visibility = 'hidden';";
	}
	echo "
	normalHeight=document.getElementById(\"mainDiv\").offsetHeight;
	thing.onchange = function() {
		";
		for($i=0;$i<count($habits);$i++) {
			echo "
		document.getElementById(\"habit" . $i . "\").style.visibility = 'hidden';";
		}
		echo "
		document.getElementById(\"habit\"+(this.selectedIndex-1)).style.visibility ='visible';
		var newBigHeight = document.getElementById(\"habit\"+(this.selectedIndex-1)).offsetHeight;
		document.getElementById(\"mainDiv\").style.height=(normalHeight+newBigHeight);
		document.getElementById(\"currentEnlarger\").style.height=(newBigHeight);
	}
}

-->
</script>
<div id=\"currentEnlarger\">
</div>
<br>
<input type=\"submit\" value=\"Send Assessment\">
";

?>